<!-- exp_15_1.html 实验15-1 -->
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html lang="en">
 <head>
  <meta charset="UTF-8">
<html>
    <head>
        <title> 表单处理事件 </title>
        <style type="text/css">
            fieldset
            {
               /* max-height: 0px;*/
               /* overflow: hidden;*/
                margin:20px auto;
                background:cadetblue;
                width:300px;
                height:250px;
                padding:20px auto;
                color:white;
                text-align:center;
            }
            span
            {
                color:cornflowerblue;
                font-size:25px;
                font-weight:bold;
                text-align:center;
            }
        </style>
        <script type="text/javascript">
            function checklogin()
            {
                var username=document.getElementById("username").value;
                var password=document.getElementById("password").value;
                if(username=="")  //两者中有一个为空
                {
                    alert("用户名不能为空！！");
                    document.getElementById("username").focus();
                    return false;
                }
                else
                {
                    if(username.length<8||username.length>20)
                    {
                        alert("用户名太短，应在8~20个字符之间！！");
                        document.getElementById("username").focus();
                        return false;
                    }
                }
                if (password=="")  //两者中有一个为空
                {
                    alert("密码不能为空！！");
                    document.getElementById("password").focus();
                    return false;
                }
                else
                {
                    if(password.length<5||password.length>20)
                    { 
                        alert("密码太短，应在6~20个字符之间！！");
                        document.getElementById("password").focus();
                        return false;
                    }
                }

                return true;
            }
            //密码验证
                function clickit2(){
                    var username=document.getElementById("username").value;
                    var password=document.getElementById("password").value;
                    alert("开始测试");
                    alert(${data.password});
                    alert(${data.username})
                    if(username==${data.password}&&password==${data.username}){
                        alert("登陆成功")
                        //alert(data.msg)
                        window.location.href= "Bookcost";
                    }else{
                        alert("账号密码都是111111，其他账号密码无效")
                    }
            }


        </script>
    </head>
    <body>

        <form name="Bookcost" method="post"  action="LagIn" onsubmit="return checklogin()">
            <fieldset>
                <span>用户登录</span>
                <br><br>
                <label>用户名</label>
                <input type="text" name="" id="username" ><br><br>
                <label>密&nbsp;&nbsp;码</label>
                <input type="password" name="" id="password" ><br><br><br>
                <input type="submit"  id="clickit" value="提交1" onclick="clickit2()"/>
                <input type="reset"/>

            </fieldset>
        </form>

    </body>
</html>
